package manager.config;
import common.SnowflakeIdWorker;
import manager.auth.service.UserPermissionService;
import manager.auth.vo.SysUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCrypt;
/**
 * 初始化操作,初始化的时候设置用户,初始化的时候用户admin拥有所有权限
 */
@Configuration
public class InitResource {
    @Autowired
    private UserPermissionService userPermissionService;
    @Bean
    public void initDbAdmin(){
         String salt=BCrypt.gensalt();
         String currentPass= BCrypt.hashpw("root",salt);
         SysUserVO user=new SysUserVO();
         user.setId(String.valueOf(SnowflakeIdWorker.nextId()));
         user.setUsername("admin");
         user.setPassword(currentPass);
         user.setSalt(salt);
    }
}
